﻿package com.badibadi.adapter;

import java.util.List;

import com.badibadi.infos.User;
import com.badibadi.uniclubber.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class Phone_MyAdapter extends BaseAdapter{
	private List<User> list;
	private Context context;
	
	public Phone_MyAdapter(Context _context,List<User> _list)
	{
		context=_context;
		list=_list;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertview, ViewGroup arg2) {
		// TODO Auto-generated method stub
		LayoutInflater layoutInflater;
		if(convertview==null)
		{
			layoutInflater=LayoutInflater.from(context);
			convertview=layoutInflater.inflate(R.layout.phone_details, null);
		}
		//User user=new User();
//		ImageView Iv1=(ImageView)convertview.findViewById(R.id.imageView1);
//		Iv1.setImageDrawable(user.getUser_head());
		
		TextView name=(TextView)convertview.findViewById(R.id.name);
		name.setText(list.get(position).getUser());
		
		TextView number=(TextView)convertview.findViewById(R.id.phone_number);
		number.setText(list.get(position).getPhoneNumber());
		
		
		return convertview;
	}
	public List<User> getList() {
		return list;
	}
	public void setList(List<User> list) {
		this.list = list;
	}

}
